// run: $exec < input
// opt: 0
// flag: -g
#include <iostream>
#include <string>

long long const  mo = 1000000007;
long long const seed = 17;
int const maxn = 100007;
long long pow[maxn];
long long dp[maxn];
long long sum[maxn];
int left[maxn];
std::string s;
std::string t;
int n, m;

void extended_gcd(long long a, long long b, long long & d, long long & x, long long & y)
{
	if (!b) { d = a; x = 1; y = 0; }
	else {
		extended_gcd(b, a % b, d, y, x);
		y -= x * (a/b);
	}
}

long long inverse(long long t, long long p)
{
	long long x, y, d;
	extended_gcd(t, p, d, x, y);
	return (x % p + p) % p;
}

long long get_hash(std::string const & s)
{
	long long h = 0;
	for (int i = 0; i < m; i++) {
		h += (long long)(s[i]) * pow[i];
		h %= mo;
	}
	return h;
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> s >> t;
	n = s.size(); m = t.size();
	pow[0] = 1;
	for (int i = 1; i <= m + 1; i++)
		pow[i] = (pow[i - 1] * seed) % mo;
	long long ht = get_hash(t);
	long long h = get_hash(s);
	int last = -1;
	for (int i = 0; i < m; i++) left[i] = -1;
	if (h == ht) left[m - 1] = last = 0;
	for (int i = m; i < n; i++) {
		h += (long long)(s[i]) * pow[m];
		h -= s[i - m];
		h %= mo;
		h *= inverse(seed, mo);
		h = ((h % mo) + mo) % mo;
		if (h == ht) left[i] = last = i - m + 1;
		else left[i] = last;
	}
	for (int i = 1; i <= n; i++) {
		if (left[i - 1] == -1) {
			dp[i] = 0;
			sum[i] = sum[i - 1];
			continue;
		}
		dp[i] = sum[left[i - 1]] + left[i - 1] + 1 + dp[i - 1];
		dp[i] %= mo;
		sum[i] = (sum[i - 1] + dp[i]) % mo;
	}
//	for (int i = 1; i <= n; i++) std::cout << dp[i] << ' ' << sum[i] << ' ' << left[i - 1] << '\n';
	std::cout << dp[n] << '\n';
}

